package Algorithm.LinkedListProblem;

/**
 * @Author cj
 * @Date 2022/1/9 18:47
 */
public class removeNodeWired {

    static class Node {
        public int value;
        public Node next;

        public Node(int val) {
            this.value = val;
        }
    }

    public static void removeNodeWired1(Node node) {
        if (node == null) {
            return;
        }
        if (node.next != null) {
            node.value = node.next.value;
            node.next = node.next.next;
        } else {
            throw new RuntimeException("can not remove last node.");
        }
    }

}
